l=12345678
r=98765432
s="2023"
ans=0
for i in range(l,r+1):
    x=str(i)
    pos=0
    for j in range(len(x)):
        if x[j]==s[pos]:
            pos=pos+1
        if pos==4:
            ans=ans+1
            break

print(r-l-ans+1)